package leecodeHot100.hash;

import java.util.*;

public class WrongCollections {
    public static void main(String[] args) {
        int[] nums = {1,2,2,4};
        int[] re =new int[2];
        HashMap<Integer,Integer> map = new HashMap<>();
        for (int i : nums) {
            map.put(i,map.getOrDefault(i,0)+1);
        }
        for(int i=1;i<=nums.length;i++){
            int count = map.getOrDefault(i,0);
            if (count == 2) {
                re[0] = i;
            } else if (count == 0) {
                re[1] = i;
            }
        }
        System.out.println(re[0]);
        System.out.println(re[1]);
    }
}
